home *** CD-ROM | disk | FTP | other *** search
- /*---------------------------------------------------------------
-
- CInterfaceProvider.cpp
-
- Provides the function of returning interface pointers based on
- passed in IDs.
-
- ---------------------------------------------------------------*/
-
- #include "IInterfaceProvider.h"
- #include "CInterfaceProvider.h"
-
- #include "CPluginInfo.h"
- #include "CPluginDrawing.h"
-
- CInterfaceProvider::CInterfaceProvider()
- :mDrawObject(0), mInfoObject(0)
- {
-
- }
-
- OSErr CInterfaceProvider::GetInterfacePointer( unsigned long inID, void** outInterfacePtr )
- {
- OSErr returnValue = noErr;
-
- // create an object based on the passed in ID
- switch( inID ){
- case IPluginInfo_ID:
- {
- // if ( mInfoObject == 0 ){
- mInfoObject = (IPluginInfoIntf*) new CPluginInfo();
- // }
- *outInterfacePtr = mInfoObject;
- } break;
-
- case IPluginDraw_ID:
- {
- // if ( mDrawObject == 0 ) {
- mDrawObject = (IPluginDrawIntf*)new CPluginDrawing();
- // }
- *outInterfacePtr = mDrawObject;
- } break;
-
- default:
- {
- returnValue = 1; // an error occured
- };
-
- }
-
- return returnValue;
- }